/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Portions created by the Initial Developer are
 * Copyright (C) 2012 the Initial Developer.
 * All Rights Reserved.
 *
 * The Original Code is "http://semi-frame.googlecode.com/svn/trenk/".
 *
 * The Initial Developer of the Original Code is the author below.
 */
/**
 * @file DbConfig.h
 * @brief auto generated.
 * @author mornongcloud
 * @date 2011/07/21
 */

#ifndef SEMICONFDBCONFIG_H_
#define SEMICONFDBCONFIG_H_

#include "semi/posix/SharedMemory.h"

namespace semi {
namespace conf {

/*
 * DbConfig
 *
 */
class DbConfig {
public:
	DbConfig();
	virtual ~DbConfig();

	bool load();
	bool setSharedMemory();

	struct DataSource {
		char user[64];
		char pass[64];
		char urn[64];
		char url[128];
		char port[8];
		char timeout[8];
		char type;
	};

	semi::posix::SharedMemory mDb;

	static std::string CONF_FILE_NAME;
	static std::string share_file_name;

	static DataSource getConfig(std::string tskid);

	static std::string toString();

private:
	std::string user;
	std::string pass;
	std::string urn;
	std::string url;
	std::string port;
	std::string timeout;
	char type;
};

}

}

#endif /* SEMICONFDBCONFIG_H_ */
